<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>t_getprotaddr</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4>NAME</h4><blockquote>
t_getprotaddr - get the protocol addresses
</blockquote><h4>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="xti.h.html">xti.h</a>&gt;

int t_getprotaddr(
    int fd,
    struct t_bind *boundaddr,
    struct t_bind *peeraddr)
</code>
</pre>
</blockquote><h4>DESCRIPTION</h4><blockquote>
<pre>
<P><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Parameters</b>
<th align=center><b>Before call</b>
<th align=center><b>After call</b>
<tr valign=top><td align=left>fd
<td align=center>x
<td align=center>/
<tr valign=top><td align=left>boundaddr-&gt;addr.maxlen
<td align=center>x
<td align=center>=
<tr valign=top><td align=left>boundaddr-&gt;addr.len
<td align=center>/
<td align=center>x
<tr valign=top><td align=left>boundaddr-&gt;addr.buf
<td align=center>?
<td align=center>(?)
<tr valign=top><td align=left>boundaddr-&gt;qlen
<td align=center>=
<td align=center>=
<tr valign=top><td align=left>peeraddr-&gt;addr.maxlen
<td align=center>x
<td align=center>=
<tr valign=top><td align=left>peeraddr-&gt;addr.len
<td align=center>/
<td align=center>x
<tr valign=top><td align=left>peeraddr-&gt;addr.buf
<td align=center>?
<td align=center>(?)
<tr valign=top><td align=left>peeraddr-&gt;qlen
<td align=center>=
<td align=center>=
</table>
</pre>
<p>
The
<i>t_getprotaddr()</i>
function returns local and remote protocol addresses currently associated
with the transport endpoint specified by
<I>fd</I>.
In
<I>boundaddr</I>
and
<I>peeraddr</I>
the user specifies
<I>maxlen,</I>
which is the maximum size (in bytes) of the address buffer, and
<I>buf</I>
which points to the buffer where the address is to be placed.
On return, the
<I>buf</I>
field of
<I>boundaddr</I>
points to the address, if any, currently bound to
<I>fd</I>,
and the
<I>len</I>
field specifies the length of the address. If the transport endpoint is in the
T_UNBND state, zero is returned in the
<I>len</I>
field of
<I>boundaddr</I>.
The
<I>buf</I>
field of
<I>peeraddr</I>
points to the address, if any, currently connected to
<I>fd</I>,
and the
<I>len</I>
field specifies the length of the address. If the transport endpoint is not in
the T_DATAXFER, T_INREL, T_OUTCON or T_OUTREL 
states, zero is returned in the
<I>len</I>
field of
<I>peeraddr</I>.
If the 
<I>maxlen</I>
field of 
<I>boundaddr</I>
or 
<I>peeraddr</I>
is set to zero, no address is returned.
</blockquote><h4>VALID STATES</h4><blockquote>
ALL - apart from T_UNINIT
</blockquote><h4>ERRORS</h4><blockquote>
On failure,
<I>t_errno</I>
is set to one of the following:
<dl compact>

<dt>[TBADF]<dd>The specified file descriptor does not refer to a transport endpoint.

<dt>[TBUFOVFLW]<dd>The number of bytes allocated for an incoming argument (<I>maxlen</I>)
is greater than 0 but not sufficient to store the value of that argument.

<dt>[TPROTO]<dd>This error indicates that a communication problem has been detected between
XTI and the transport provider for which there is no other suitable XTI
error
<I>(t_errno)</I>.

<dt>[TSYSERR]<dd>A system error has occurred during execution of this function.

</dl>
</blockquote><h4>RETURN VALUE</h4><blockquote>
Upon successful completion, a value of zero is returned.  Otherwise,
a value of -1 is returned and
<I>t_errno</I>
is set to indicate the error.
</blockquote><h4>SEE ALSO</h4><blockquote>
<i><a href="t_bind.html">t_bind()</a></i>.
<br>
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
